package vip.pwztx.entity;

import lombok.Data;
import vip.pwztx.constant.ResultCode;

/**
 * 返回结果类
 *
 * @author zhoubaohua
 * @date 2020/8/28
 */
@Data
public class Result {

    /**
     * 结果代码
     */
    private int code;

    /**
     * 数据
     */
    private Object data;

    /**
     * 信息
     */
    private String message;

    public static Result ofSuccess(Object data){
        return new Result(){{
            setCode(ResultCode.SUCCESS.getCode());
            setData(data);
            setMessage(ResultCode.SUCCESS.getMessage());
        }};
    }
}
